package com.lucker.common.util;



import java.util.ArrayList;
import java.util.List;

import com.lucker.common.model.BetMenuObj;
import com.lucker.common.model.BetTargetObj;
import com.lucker.common.model.TempLotteryValues;

/**
 * Created by PC on 2019/1/4.
 */

public class BetUtil {
    //n的阶乘 n!
    public static int factorial(int n) {
        int value = 1;
        for (int i = n; i > 0; i--) {
            value = value * i;
        }
        return value;
    }

    /**
     * 在 m 个数中选 n 个的组合数
     */
    public static int combination(int m, int n) {
        if (m < n) {
            return 0;
        }
        return factorial(m) / factorial(n) / factorial(m - n);
    }

    public static int arrangement(int m,int n){
        if(m<n){
            return 0;
        }else {
            return factorial(m)/factorial(m-n);
        }
    }

    /**
     * 如11x5 任二玩法 选择4个号码
     * @param x1 可供选择的号码数量 11
     * @param x2 中奖的号码数量  5
     * @param x3 玩法应该选择号码的数量 2
     * @param x4 选择了号码的数量 4
     * @return
     */
    private static double getProbability(int x1, int x2, int x3, int x4) { // 11, 5, 3, 4: 11 选 5 任 3 4 码
        double probability = 0;
        if (x3 <= x2) {
            double n1 = combination(x1, x4);
            double n2 = 0;
            for (int i = x4; i >= x3; i--) {
                n2 = n2 + combination(x2, i) * combination(x1 - x2, x4 - i);
            }
            probability = n2 / n1;
        } else {
            double n1 = combination(x1, x2);
            double n2 = combination(x4, x2);
            probability = n2 / n1;
        }
        return probability;
    }

    //快三二不同玩法n码中奖概率
    public static double getK3Probability(int n){
       return (combination(n,3)*arrangement(3,3)+combination(n,2)*combination(6-n,1)*arrangement(3,3)+combination(n,2)*arrangement(3,2))/216d;
    }

    public static int getHitCount2(int x1, int x2, int x3, int x4) {
        if (x3 == 0) {
            return combination(x1 - x2, x4);
        }
        int n = combination(x2, x3) * combination(x1 - x2, x4 - x3);
        return n;
    }

    public static double countK12Probability(int caiTypeNumberCounts,BetTargetObj betTargetObj, int betCount) {
        double probability = 0;
        int numCount = caiTypeNumberCounts;
        int typeId = Integer.valueOf(betTargetObj.getBetMenuObj().getTypeId());
        int count1 = betTargetObj.getFirstNumsList().size();
        int count2 = betTargetObj.getSecondNumsList().size();
        if (typeId <= 6) {
            probability = getProbability(numCount, 5, typeId + 2, count1);
        } else if (typeId >= 7 && typeId <= 11) {
            if(numCount==11){
                probability = betCount / TempLotteryValues.K11_PROBABILITY_LIST[typeId - 7];
            }else if(numCount==12){
                probability = betCount / TempLotteryValues.K12_PROBABILITY_LIST[typeId - 7];
            }
        } else if (typeId >= 12 && typeId <= 15) {
            double n1 = getProbability(numCount, 5, count1, count1);
            double n2 = getProbability(numCount - count1, 5 - count1, (typeId - 10) - count1, count2);
            probability = n1 * n2;
        } else if (typeId >= 16 && typeId <= 18) {
            double n1 = combination(numCount, count1) * combination(numCount - count1, count2);
            double n2 = 0;
            for (int i = 0; i <= (typeId - 10) - 5; i++) {
                n2 += getHitCount2(numCount, 5, count1 - i, count1) * getHitCount2(numCount - count1, 5 - count1 + i, 5 - count1 + i, count2);
            }
            probability = n2 / n1;
        } else if (typeId >= 19 && typeId <= 20) {
            if(numCount==11){
                probability = betCount / TempLotteryValues.K11_PROBABILITY_LIST[typeId - 14];
            }else if(numCount==12){
                probability = betCount / TempLotteryValues.K12_PROBABILITY_LIST[typeId - 14];
            }
        }
        return probability;
    }

    //计算快乐12和11选5最大最小中奖注数
    public static int[] countK12CashCount(int caiTypeNumberCounts,BetTargetObj betTargetObj, int betCounts) {
        if (betCounts == 0) {
            return new int[]{0, 0};
        }
        int numCount=caiTypeNumberCounts;
        int mMaxCashCount = 1;
        int mMinCashCount = 1;
        int mTypeId = Integer.valueOf(betTargetObj.getBetMenuObj().getTypeId());
        int mBallCount = betTargetObj.getFirstNumsList().size();

        if (mTypeId >= 0 && mTypeId <= 6) {
            if (mBallCount <= 5) {
                mMaxCashCount = betCounts;
            } else {
                if (mTypeId + 2 <= 5) {
                    mMaxCashCount = combination(5, mTypeId + 2);
                    if (5 - (numCount - mBallCount) > mTypeId + 2) {
                        mMinCashCount = combination(5 - (numCount - mBallCount), mTypeId + 2);
                    }
                } else {
                    mMinCashCount = combination(mBallCount - 5, mTypeId + 2 - 5);
                }
            }
        } else if (mTypeId == 7) {
            mMaxCashCount = 1;
        } else if (mTypeId == 8) {
            mMaxCashCount = 1;
        } else if (mTypeId == 9) {
            mMaxCashCount = 1;
        } else if (mTypeId == 10) {
            mMaxCashCount = 1;
        } else if (mTypeId == 11) {
            mMaxCashCount = 1;
        } else if (mTypeId == 19) {
            mMaxCashCount = 1;
        } else if (mTypeId == 20) {
            mMaxCashCount = 1;
        } else if (mTypeId >= 12 && mTypeId <= 18) {
            int mBallCount2 = betTargetObj.getSecondNumsList().size();
            if (mTypeId - 10 < 5) {
                int n;
                if (mBallCount + mBallCount2 > 5) {
                    n = 5 - mBallCount;
                } else {
                    n = mBallCount2;
                }
                mMaxCashCount = combination(n, mTypeId - 10 - mBallCount);
            } else if (mTypeId - 10 > 5) {
                mMaxCashCount = combination(mBallCount + mBallCount2 - 5, mTypeId - 10 - 5);
            }

            if (5 - (numCount - (mBallCount + mBallCount2)) > mTypeId - 10) {
                mMinCashCount = combination(5 + mBallCount2 - numCount, mTypeId - 10 - mBallCount);
            }

            if (mTypeId - 10 - mBallCount - 5 > 0) {
                mMinCashCount = combination(mBallCount2 - 5, mTypeId - 10 - mBallCount - 5);
            }

            if (mMaxCashCount > betCounts) {
                mMaxCashCount = betCounts;
            }
        }
        if (mMaxCashCount == 1) {
            mMaxCashCount = mMinCashCount;
        }
        if (mMaxCashCount > mMinCashCount) {
            return new int[]{mMinCashCount, mMaxCashCount};
        } else {
            return new int[]{mMaxCashCount, mMinCashCount};
        }
    }

    //计算11选5和快乐12的单一玩法的注数
    public static int get11x5BetCounts(BetTargetObj betTargetObj) {
        int betCounts = 0;
        int typeId = Integer.valueOf(betTargetObj.getBetMenuObj().getTypeId());
        List<Integer> firstNumsList = betTargetObj.getFirstNumsList();
        if(firstNumsList.size()==0){
            return betCounts;
        }
        List<Integer> secondNumsList = betTargetObj.getSecondNumsList();
        List<Integer> thirdNumsList = betTargetObj.getThirdNumsList();
        if (typeId <= 6) {//任二到任八
            betCounts = combination(firstNumsList.size(), typeId + 2);
        } else if (typeId == 7) {//前一直选
            betCounts = firstNumsList.size();
        } else if (typeId == 8) {//前二直选
            if (firstNumsList.size() * secondNumsList.size() == 0) {
                betCounts = 0;
            } else {
                for (int x : firstNumsList) {
                    for (int y : secondNumsList) {
                        if (x != y) {
                            betCounts++;
                        }
                    }
                }
            }
        } else if (typeId == 10) {//前三直选
            if (firstNumsList.size() * secondNumsList.size() == 0 * thirdNumsList.size()) {
                betCounts = 0;
            } else {
                for (int x : firstNumsList) {
                    for (int y : secondNumsList) {
                        for (int z : thirdNumsList) {
                            if (x != y && x != z && y != z) {
                                betCounts++;
                            }
                        }
                    }
                }
            }
        } else if (typeId == 9) {//前二组
            betCounts = combination(firstNumsList.size(), 2);
        } else if (typeId == 11) {//前三组
            betCounts = combination(firstNumsList.size(), 3);
        } else if (typeId < 19) {//任二到任八胆拖
            betCounts = combination(secondNumsList.size(), typeId - 10 - firstNumsList.size());
        } else {//组二，组三胆拖
            betCounts = combination(secondNumsList.size(), typeId - 17 - firstNumsList.size());
        }
        return betCounts;
    }

    //k12和11选5胆拖玩法转化为普通玩法
    public static BetMenuObj turnK12DanToNormal(List<BetMenuObj> betMenuListObjs,BetMenuObj betMenuObj) {
        int typeId=Integer.valueOf(betMenuObj.getTypeId());
        if (typeId<12){
            return betMenuObj;
        }else {
            if (typeId >= 12 && typeId <= 18) {
                typeId = typeId - 12;
            } else if (typeId == 19) {
                typeId = 9;
            } else if (typeId == 20) {
                typeId = 11;
            }
            for (BetMenuObj obj : betMenuListObjs){
                if(typeId==Integer.valueOf(obj.getTypeId())){
                    return obj;
                }
            }
        }
        return betMenuObj;
    }

    //k12和11选5根据id获取玩法对象
//    public static BetMenuObj getBetMenuObjById(Context context, int typeId) {
//        List<BetMenuListObj> betMenuListObjs = ChartDataUtil.fromLocalFileJsonToBetGroupList(context);
//        for (BetMenuObj obj:betMenuListObjs.get(0).getGroupList()){
//            if(typeId==Integer.valueOf(obj.getTypeId())){
//                return obj;
//            }
//        }
//        return null;
//    }

    //n:选出的号码个数；isNeedSort：是否需要排序
    /*public static BetTargetObj getk12And11x5RandomBet(int caiTypeNumberCounts,BetMenuObj betMenuObj) {
        ArrayList<Integer> ballTotal = new ArrayList<>();
        ArrayList<Integer> ballSelect = new ArrayList<>();

        boolean isNeedSort = false;
        int n = 0;
        int length = caiTypeNumberCounts;
        int startNum = 1;
        int type = Integer.valueOf(betMenuObj.getTypeId());
        if (type == 0 || type == 12 || type == 9 || type == 19) {//任二,组二
            n = 2;
            isNeedSort = true;
        } else if (type == 1 || type == 13 || type == 11 || type == 20) {//任三,组三
            n = 3;
            isNeedSort = true;
        } else if (type == 2 || type == 14) {//任四
            n = 4;
            isNeedSort = true;
        } else if (type == 3 || type == 15) {//任五
            n = 5;
            isNeedSort = true;
        } else if (type == 4 || type == 16) {//任六
            n = 6;
            isNeedSort = true;
        } else if (type == 5 || type == 17) {//任七
            n = 7;
            isNeedSort = true;
        } else if (type == 6 || type == 18) {//任八
            n = 8;
            isNeedSort = true;
        } else if (type == 7) {//前一直选
            n = 1;
            isNeedSort = false;
        } else if (type == 8) {//前二直选
            n = 2;
            isNeedSort = false;
        } else if (type == 10) {//前三直选
            n = 3;
            isNeedSort = false;
        } else {
            return null;
        }
        for (int i = startNum; i <= length; i++) {
            ballTotal.add(i);
        }
        Random ran = new Random();
        int index = -1;
        for (int i = 0; i < n; i++) {
            index = ran.nextInt(ballTotal.size() - i);
            ballSelect.add(ballTotal.get(index));
            int temp = ballTotal.get(index);
            ballTotal.set(index, ballTotal.get(ballTotal.size() - 1 - i));
            ballTotal.set(ballTotal.size() - 1 - i, temp);
        }
        if (isNeedSort) {
            Collections.sort(ballSelect);
        }

        List<Integer> integerList_1 = new ArrayList<>();
        List<Integer> integerList_2 = new ArrayList<>();
        List<Integer> integerList_3 = new ArrayList<>();
        if(type==8){//前二直选
            integerList_1.add(ballSelect.get(0));
            integerList_2.add(ballSelect.get(1));
        }else if(type==10){//前三直选
            integerList_1.add(ballSelect.get(0));
            integerList_2.add(ballSelect.get(1));
            integerList_3.add(ballSelect.get(2));
        }else {
            integerList_1.addAll(ballSelect);
        }
        BetTargetObj betTargetObj = new BetTargetObj(betMenuObj,integerList_1,integerList_2,integerList_3);
        return betTargetObj;
    }*/

    //实现集合的组合

    /**
     * @param selector 选完的集合 初始化为空
     * @param data		待选集合
     * @param n			选出的数量
     */
    public static List<List<Integer>> combinations(List<Integer> selector, List<Integer> data, int n) {
        List<List<Integer>> lists = new ArrayList<>();
        if (n == 0) {
            List<Integer> list = new ArrayList<>();
            for (int i : selector) {
                list.add(i);
            }
            lists.add(list);
            return lists;
        }
        if (data.isEmpty()) {
            return lists;
        }
        //选择第一个元素,将元素放入集合
        selector.add(data.get(0));
        lists.addAll(combinations(selector, data.subList(1, data.size()), n - 1));//从第二个元素开始选择，再选择两个
        // 不选择第一个元素
        selector.remove(selector.size() - 1);
        lists.addAll(combinations(selector, data.subList(1, data.size()), n)); //从第二个元素开始选择，选择两个
        return lists;
    }

    //全排列
    public static List<List<Integer>> permute(List<Integer> nums) {
        List<List<Integer>> all = new ArrayList<List<Integer>>();
        allSort(nums, 0, nums.size() - 1, all);
        return all;
    }

    public static void allSort(List<Integer> array, int begin, int end, List<List<Integer>> all) {
        if (begin == end) {
            List<Integer> origi = new ArrayList<Integer>();
            for (int a : array) {
                origi.add(a);
            }
            all.add(origi);
            return;
        }
        for (int i = begin; i <= end; i++) {
            swap(array, begin, i);
            allSort(array, begin + 1, end, all);
            swap(array, begin, i);
        }
    }

    public static void swap(List<Integer> array, int a, int b) {
        int tem = array.get(a);
        array.set(a, array.get(b));
        array.set(b, tem);
    }

    //所有组合号码
    public static List<List<Integer>> getCombinationNumberList(int caiTypeNumberCounts) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i< caiTypeNumberCounts; i++){
            list.add(i+1);
        }
        return BetUtil.combinations(new ArrayList<Integer>(),list,5);
    }

    //所有排列号码
    public static List<List<Integer>> getAllNumberList(int caiTypeNumberCounts) {
        List<List<Integer>> allNumberList = new ArrayList<>();
        for (List<Integer> list:getCombinationNumberList(caiTypeNumberCounts)) {
            //排序
            List<List<Integer>> permuteList = BetUtil.permute(list);
            allNumberList.addAll(permuteList);
        }
        return allNumberList;
    }

    //计算追号的中奖概率
    public static double getAIPlanProbability(int times, double baseProbability) {
        double antiProbability = 1 - baseProbability;
        return 1 - Math.pow(antiProbability, times);
    }

    public static List<List<Integer>> getSingleNumberList(BetTargetObj betTargetObj) {
        List<List<Integer>> singleNumberList = new ArrayList<>();
        int typeId = Integer.valueOf(betTargetObj.getBetMenuObj().getTypeId());
        if (typeId <= 6) {//任二到任八
            singleNumberList = combinations(new ArrayList<Integer>(), betTargetObj.getFirstNumsList(), typeId + 2);
        } else if (typeId == 7) {//前一直选
            singleNumberList = combinations(new ArrayList<Integer>(), betTargetObj.getFirstNumsList(), 1);
        } else if (typeId == 8) {//前二直选
            for (int x : betTargetObj.getFirstNumsList()) {
                for (int y : betTargetObj.getSecondNumsList()) {
                    if (x != y) {
                        List<Integer> inList = new ArrayList<>();
                        inList.add(x);
                        inList.add(y);
                        singleNumberList.add(inList);
                    }
                }
            }
        } else if (typeId == 10) {//前三直选
            for (int x : betTargetObj.getFirstNumsList()) {
                for (int y : betTargetObj.getSecondNumsList()) {
                    for (int z : betTargetObj.getThirdNumsList()) {
                        if (x != y && x != z && y != z) {
                            List<Integer> inList = new ArrayList<>();
                            inList.add(x);
                            inList.add(y);
                            inList.add(z);
                            singleNumberList.add(inList);
                        }
                    }
                }
            }
        } else if (typeId == 9) {//前二组
            singleNumberList = combinations(new ArrayList<Integer>(), betTargetObj.getFirstNumsList(), 2);
        } else if (typeId == 11) {//前三组
            singleNumberList = combinations(new ArrayList<Integer>(), betTargetObj.getFirstNumsList(), 3);
        } else if (typeId < 19) {
            singleNumberList = combinations(new ArrayList<Integer>(), betTargetObj.getSecondNumsList(), typeId - 10 - betTargetObj.getFirstNumsList().size());
            for (List<Integer> inList : singleNumberList) {
                for (int i : betTargetObj.getFirstNumsList()) {
                    inList.add(i);
                }
            }
        } else {
            singleNumberList = combinations(new ArrayList<Integer>(), betTargetObj.getSecondNumsList(), typeId - 17 - betTargetObj.getFirstNumsList().size());
            for (List<Integer> inList : singleNumberList) {
                for (int i : betTargetObj.getFirstNumsList()) {
                    inList.add(i);
                }
            }
        }
        return singleNumberList;
    }

    /**
     * 根据固定盈利率生成推荐方案
     * @param baseProbability 基础中奖概率
     * @param baseMinAwardMoney 基础最小中奖金额
     * @param baseBetCounts 基础投注注数
     */
    public static void getRecommendPlanByFixedProfitability(double baseProbability, int baseMinAwardMoney, int baseBetCounts){
        int issueNoOffset = 0;//期号偏移量
        int currentMultiple = 1;//当前期投注倍数
        int totalMoney = 0;//总投注金额
        int baseBetMoney = baseBetCounts*2;//基础投注金额
        double targetProfitability = 1.2d;//目标盈利率
        double baseProfitability = (baseMinAwardMoney - baseBetMoney)*1d/baseBetMoney;//基础盈利率
        if(baseProfitability<0.2d){
            //基础盈利率小于20%，盈利率太低，不生成推荐方案
            //Log.e("---xia03---","基础盈利率小于20%，盈利率太低，不生成推荐方案");
        	
            return;
        }else if(baseProfitability<0.5d){
            targetProfitability = 1.05d;
        }else if(baseProfitability<1d){
            targetProfitability = 1.1d;
        }else if(baseProfitability<2d){
            targetProfitability = 1.15d;
        }else {
            targetProfitability = 1.2d;
        }
        while (true){
            issueNoOffset++;
            while (true){
                int currentMinAwardMoney = currentMultiple*baseMinAwardMoney;//当前期最小中奖金额
                int tempTotalMoney = totalMoney+currentMultiple*baseBetMoney;//临时投入总金额
                if(tempTotalMoney>=1000){
                    if(targetProfitability>=1.15d){
                        targetProfitability = 1.1d;
                    }
                }else if(tempTotalMoney>=1500){
                    if(targetProfitability>=1.1d){
                        targetProfitability = 1.07d;
                    }
                }else if(tempTotalMoney>=2000){
                    if(targetProfitability>=1.05d){
                        targetProfitability = 1.05d;
                    }
                }else if(tempTotalMoney>=5000){
                    targetProfitability = 1.02d;
                }
                if(currentMinAwardMoney<tempTotalMoney*targetProfitability){//不满足盈利条件，倍数+1
                    currentMultiple++;
                    if(currentMultiple>=1000){
                        break;
                    }
                }else {
                    break;
                }
            }
            totalMoney = totalMoney + currentMultiple*baseBetMoney;
            double aiPlanProbability = getAIPlanProbability(issueNoOffset,baseProbability);//方案中奖概率
            if(totalMoney>1000&&aiPlanProbability>=0.8d){
                if(aiPlanProbability>=0.9d){
                    //中奖概率大于90%，不再生成方案
                }else {
                    //中奖率不够，追加一期方案
                    String text = "期号："+issueNoOffset+"; 当期投入："+currentMultiple*baseBetMoney+"; 累计："+totalMoney+"; 最低中奖金额："+currentMultiple*baseMinAwardMoney+";";
                }
                break;
            }else {
                String text = "期号："+issueNoOffset+"; 当期投入："+currentMultiple*baseBetMoney+"; 累计："+totalMoney+"; 最低中奖金额："+currentMultiple*baseMinAwardMoney+";";
            }
        }
    }


    /**
     * 计算n期内某一玩法的开出最少的号码
     * @param betMenuObj
     * @param n
     * @return
     */
//    public static List<List<Integer>> getRecommendPlanNumbers(int caiTypeNumberCounts,BetMenuObj betMenuObj, int n){
//        List<List<Integer>> allNumberList = null;
//        ArrayList<Integer> list = new ArrayList<>();
//        for (int i = 0; i< caiTypeNumberCounts; i++){
//            list.add(i+1);
//        }
//        if(Integer.valueOf(betMenuObj.getTypeId()) == BetMenuObj.K12_AND_11X5_ANY_2){
//            allNumberList = BetUtil.combinations(new ArrayList<Integer>(),list,2);
//        }else if(Integer.valueOf(betMenuObj.getTypeId()) == BetMenuObj.K12_AND_11X5_ANY_3){
//            allNumberList = BetUtil.combinations(new ArrayList<Integer>(),list,3);
//        }else if(Integer.valueOf(betMenuObj.getTypeId()) == BetMenuObj.K12_AND_11X5_ANY_4){
//            allNumberList = BetUtil.combinations(new ArrayList<Integer>(),list,4);
//        }else if(Integer.valueOf(betMenuObj.getTypeId()) == BetMenuObj.K12_AND_11X5_ANY_5){
//            allNumberList = BetUtil.combinations(new ArrayList<Integer>(),list,5);
//        }else if(Integer.valueOf(betMenuObj.getTypeId()) == BetMenuObj.K12_AND_11X5_ANY_6){
//            allNumberList = BetUtil.combinations(new ArrayList<Integer>(),list,6);
//        }
//        List<AwardObj> awardObjs = GreenDaoManager.getInstance().loadLastNAwardObj(n);
//        List<RecommendNumsObj> recommendNumsObjs = new ArrayList<>();
//        for (List<Integer> fixedNums:allNumberList){
//            int count = 0;
//            for (AwardObj awardObj:awardObjs){
//                if(Integer.valueOf(betMenuObj.getTypeId()) <= BetMenuObj.K12_AND_11X5_ANY_5){
//                    if(awardObj.getNumbers().containsAll(fixedNums)){
//                        count++;
//                    }
//                }else {
//                    if(fixedNums.containsAll(awardObj.getNumbers())){
//                        count++;
//                    }
//                }
//            }
//            RecommendNumsObj recommendNumsObj = new RecommendNumsObj();
//            recommendNumsObj.setCount(count);
//            recommendNumsObj.setTotalN(n);
//            recommendNumsObj.setNumbers(fixedNums);
//
//            recommendNumsObjs.add(recommendNumsObj);
//        }
//        Collections.sort(recommendNumsObjs);
//        List<List<Integer>> mList = new ArrayList<>();
//        for (int i=0;i<recommendNumsObjs.size();i++){
//            if(i==5){
//                break;
//            }
//            mList.add(recommendNumsObjs.get(i).getNumbers());
//        }
//        Log.e("---recomend1---",n+":"+new Gson().toJson(mList));
//
//        List<List<Integer>> mList1 = new ArrayList<>();
//        for (int i=recommendNumsObjs.size()-1;i>=0;i--){
//            if(i==recommendNumsObjs.size()-6){
//                break;
//            }
//            mList1.add(recommendNumsObjs.get(i).getNumbers());
//        }
//        Log.e("---unrecomend---",n+":"+new Gson().toJson(mList1));
//        return mList;
//    }

//    public static void getFinalNums(BetMenuObj betMenuObj){
//        List<List<Integer>> list1 = BetUtil.getRecommendPlanNumbers(betMenuObj,3000);
//        List<List<Integer>> list2 = BetUtil.getRecommendPlanNumbers(betMenuObj,2000);
//        List<List<Integer>> list3 = BetUtil.getRecommendPlanNumbers(betMenuObj,1000);
//        List<List<Integer>> list4 = BetUtil.getRecommendPlanNumbers(betMenuObj,500);
//        List<List<Integer>> list5 = BetUtil.getRecommendPlanNumbers(betMenuObj,100);
//        List<List<Integer>> allList = new ArrayList<>();
//        allList.addAll(list1);
//        allList.addAll(list2);
//        allList.addAll(list3);
//        allList.addAll(list4);
//        //Log.e("---recommmend---",new Gson().toJson(numCounts));
//        List<RecommendNumsObj> recommendNumsObjs = new ArrayList<>();
//        for (List<Integer> nums1:allList){
//            boolean isContains = false;
//            for (RecommendNumsObj recommendNumsObj:recommendNumsObjs){
//                if(nums1.equals(recommendNumsObj.getNumbers())){
//                    isContains = true;
//                    recommendNumsObj.setCount(recommendNumsObj.getCount()+1);
//                }
//            }
//            if(!isContains){
//                RecommendNumsObj recommendNumsObj = new RecommendNumsObj();
//                recommendNumsObj.setNumbers(nums1);
//                recommendNumsObj.setCount(1);
//                recommendNumsObjs.add(recommendNumsObj);
//            }
//        }
//        Collections.sort(recommendNumsObjs);
//        Log.e("---recomend---",new Gson().toJson(recommendNumsObjs));
//        Log.e("---recomend---",new Gson().toJson(recommendNumsObjs.get(recommendNumsObjs.size()-1)));
//    }
    
    
    public static int getCaiTypeNumberCount(int current_cai_type) {
    	if(current_cai_type==1){
    	    return 11;
    	}else if(current_cai_type==2){
    	    return 12;
    	}
    	return 0;
    }
}
